package cn.itcast.gateway.filter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * @Author:王亚栋
 * @Date: 2023/6/1 下午10:08
 * @Version:1.0
 * 自定义全局过滤器
 */
@Component
@Slf4j(topic = "LoginFilter")
public class LoginFilter implements GlobalFilter, Ordered {


    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {

        log.info("请求地址:{}",exchange.getRequest().getPath().value());


        return  chain.filter(exchange);
    }

    @Override
    public int getOrder() {
        return 1;
    }
}
